#include<iostream>
using namespace std;
__int64 Combination(int n,int m){
	int i;
	__int64 res1=1,res2=1;
	for(i=1;i<=m;i++){
		res1*=(n-i+1);
		res2*=i;
	}
	return res1/res2;
}
int main()
{
    long long i,j,k,s,n,a[15];
    a[0]=0,a[1]=0,a[2]=1;
    for(i=3;i<=15;i++){
        a[i]=(i-1)*(a[i-1]+a[i-2]);
    }
    while (cin>>n&&n!=0)
    {
        if(n%2==0)
        k=n/2;
        else
        k=n/2+1;
        s=0;
        for(i=k;i<n;i++){
            s=s+Combination(n,i)*a[i-1];
        }
        cout<<s+1<<endl;
    }
    
}